home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / ISR.SWG / 0004_ISRDEMO1.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  61 lines

  1. {
  2. │- Also, is there anyway of making "HOT-KEYS" without using ReadKey f│
  3. │  CharS?  I want it For Integers or can I have CharS as a RANdoM #? │
  4. │  PROBLEMO!                                                         │
  5.  
  6. > Unless you want to Write an ISR (initiate and stay resident) routine   │
  7. > that traps keyboard interrupts and either preprocesses them or passes  │
  8. > them on to your routine, ReadKey is the only way. (Writing an ISR      │
  9. > is not a simple task.)                                                 │
  10.  
  11. Actualy it is not that difficult in pascal:
  12. }
  13. Uses
  14.   Dos;
  15.  
  16. Const
  17.   end_eks : Boolean = False;
  18.  
  19. Var
  20.   IntVec  : Pointer;
  21.  
  22. Procedure Keybd; Interrupt;
  23. Var
  24.   Key : Byte;
  25. begin
  26.   Asm
  27.     cli
  28.   end;
  29.   Key := Port[$60];
  30.  
  31.   Case Key of
  32.     1   : end_eks := True;
  33.     57  : Writeln(' You have pressed Space');
  34.     75  : Writeln(' Left Arrow');
  35.     77  : Writeln(' Right Arrow');
  36.     203,
  37.     205 : Writeln(' You have released an Arrow key');
  38.   end;
  39.  
  40.   if not end_eks then
  41.   Asm
  42.     mov ah,0ch
  43.     int 21h
  44.     call IntVec  { Call original int 9 handler }
  45.   end;
  46.   { port[$20]:=$20} { if you dont call the original handler
  47.                       you need to uncomment this }
  48. end;
  49.  
  50. begin
  51.   GetIntVec($09,Intvec);
  52.   SetIntVec($09,@Keybd);
  53.   Writeln(' Press <ESC> to end Program ');
  54.  
  55.   Repeat Until end_eks;
  56.  
  57.   SetIntVec($09,IntVec);
  58.  
  59.   Writeln(' Program terminatet');
  60.  
  61. end.